import re
txt='In the heart of the city stood an old bookstore, filled with the scent of aged paper and ink. Its shelves were lined with books from floor to ceiling, each holding stories of adventure, romance, and mystery. Among them was a worn-out copy of "Pride and Prejudice," which had seen many readers over the years. The shopkeeper, Mr. Thompson, greeted every customer with a warm smile, eager to share his love for literature.\n On a quiet afternoon, a young girl named Emily entered, her eyes sparkling with curiosity. She wandered through the stacks, her fingers gliding over spines until she found a book on mythology. Captivated by the tales within, she decided to purchase it. As she left, Mr. Thompson waved goodbye, hoping the book would ignite a lifelong passion for reading in her.'
with open('word.txt','w',encoding='utf-8') as f:
    f.write(txt)
with open('word.txt','r',encoding='utf-8') as f:
    content=f.read()
pattern=r'\b[a-zA-Z]+\b'
words=re.findall(pattern,content)
words_num=len(words)
print(f'There are {words_num} words in word.txt')